home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-20 | 52.3 KB | 2,152 lines |
- Newsgroups: comp.sources.misc
- From: tony@ajfcal.cuc.ab.ca (Tony Field)
- Subject: v27i096: psf3 - Postscript print filter system, v3, Part05/09
- Message-ID: <1992Jan21.013318.11472@sparky.imd.sterling.com>
- X-Md4-Signature: 3bf4a9b817ec5eecb089f4658dbe2c65
- Date: Tue, 21 Jan 1992 01:33:18 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: tony@ajfcal.cuc.ab.ca (Tony Field)
- Posting-number: Volume 27, Issue 96
- Archive-name: psf3/part05
- Environment: ISC, SUNOS, SYSVR3, DOS
- Supersedes: psf2: Volume 12, Issue 4-9
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 5 (of 9)."
- # Contents: defs/epl3kf51.def getsizes.PS language.PSF man/psfbs.1
- # man/psfbs.doc man/psfdoub.1 man/psfdoub.doc psfbs.c psfmail.c
- # selectdef.c
- # Wrapped by ajf@trifid on Sat Jan 18 22:55:49 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'defs/epl3kf51.def' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'defs/epl3kf51.def'\"
- else
- echo shar: Extracting \"'defs/epl3kf51.def'\" \(2791 characters\)
- sed "s/^X//" >'defs/epl3kf51.def' <<'END_OF_FILE'
- X*printer
- XEPSON LP-3000PS F5 v52.3
- X*paper 13
- XLetter
- Xstatusdict begin lettertray end
- X 612 792 12 13 602 780
- XLegal
- Xstatusdict begin legaltray end
- X 612 1008 12 12 594 996
- XExecutive
- Xstatusdict begin executivetray end
- X 522 756 12 12 510 744
- XA4
- Xstatusdict begin a4tray end
- X 595 842 12 12 579 830
- XA5
- Xstatusdict begin a5tray end
- X 420 595 10 10 408 585
- XB5
- Xstatusdict begin b5tray end
- X 516 729 12 12 502 717
- XStatement
- Xstatusdict begin halflettertray end
- X 396 612 12 12 379 600
- XLetterSmall
- Xstatusdict begin lettertray end lettersmall
- X 0 0 30 30 582 762
- XA4Small
- Xstatusdict begin a4tray end a4small
- X 0 0 31 31 559 811
- XGLT
- Xstatusdict begin glttray end
- X 576 756 12 13 572 744
- XGLG
- Xstatusdict begin glgtray end
- X 612 936 12 13 602 924
- XF4
- Xstatusdict begin f4tray end
- X 595 935 12 12 579 923
- XHagaki
- Xstatusdict begin hagakitray end
- X 284 420 12 12 272 408
- X*order 1
- XNormal
- X*fonts 80
- XAvantGarde-Book
- XAvantGarde-Demi
- XBookman-Demi
- XBookman-Light
- XCourier
- XHelvetica
- XHelvetica-Narrow
- XNewCenturySchlbk-Roman
- XPalatino-Roman
- XSymbol
- XTimes-Roman
- XZapfChancery-MediumItalic
- XZapfDingbats
- XGothicBBB-Medium-83pv-RKSJ-H
- XGothicBBB-Medium-83pv-RKSJ-H
- XGothicBBB-Medium-Add-H
- XGothicBBB-Medium-Add-RKSJ-H
- XGothicBBB-Medium-Add-RKSJ-V
- XGothicBBB-Medium-Add-V
- XGothicBBB-Medium-EUC-H
- XGothicBBB-Medium-EUC-V
- XGothicBBB-Medium-Ext-H
- XGothicBBB-Medium-Ext-RKSJ-H
- XGothicBBB-Medium-Ext-RKSJ-V
- XGothicBBB-Medium-Ext-V
- XGothicBBB-Medium-H
- XGothicBBB-Medium-NWP-H
- XGothicBBB-Medium-NWP-V
- XGothicBBB-Medium-RKSJ-H
- XGothicBBB-Medium-RKSJ-UserGaiji
- XGothicBBB-Medium-RKSJ-UserGaiji
- XGothicBBB-Medium-RKSJ-V
- XGothicBBB-Medium-V
- XGothicBBB-Medium.Oubun
- XGothicBBB-Medium.Roman
- XGothicBBB-Medium.WP-Symbol
- XJun101-Light-83pv-RKSJ-H
- XJun101-Light-Add-H
- XJun101-Light-Add-RKSJ-H
- XJun101-Light-Add-RKSJ-V
- XJun101-Light-Add-V
- XJun101-Light-EUC-H
- XJun101-Light-EUC-V
- XJun101-Light-Ext-H
- XJun101-Light-Ext-RKSJ-H
- XJun101-Light-Ext-RKSJ-V
- XJun101-Light-Ext-V
- XJun101-Light-H
- XJun101-Light-NWP-H
- XJun101-Light-NWP-V
- XJun101-Light-RKSJ-H
- XJun101-Light-RKSJ-UserGaiji
- XJun101-Light-RKSJ-V
- XJun101-Light-V
- XJun101-Light.Oubun
- XJun101-Light.Roman
- XJun101-Light.WP-Symbol
- XPCJun101-Light
- XRyumin-Light-83pv-RKSJ-H
- XRyumin-Light-83pv-RKSJ-H
- XRyumin-Light-Add-H
- XRyumin-Light-Add-RKSJ-H
- XRyumin-Light-Add-RKSJ-V
- XRyumin-Light-Add-V
- XRyumin-Light-EUC-H
- XRyumin-Light-EUC-V
- XRyumin-Light-Ext-H
- XRyumin-Light-Ext-RKSJ-H
- XRyumin-Light-Ext-RKSJ-V
- XRyumin-Light-Ext-V
- XRyumin-Light-H
- XRyumin-Light-NWP-H
- XRyumin-Light-NWP-V
- XRyumin-Light-RKSJ-H
- XRyumin-Light-RKSJ-UserGaiji
- XRyumin-Light-RKSJ-V
- XRyumin-Light-V
- XRyumin-Light.Oubun
- XRyumin-Light.Roman
- XRyumin-Light.WP-Symbol
- X*slots 2
- Xstatusdict begin 0 setpapertray end
- Xstatusdict begin 1 setpapertray end
- X*eof
- END_OF_FILE
- if test 2791 -ne `wc -c <'defs/epl3kf51.def'`; then
- echo shar: \"'defs/epl3kf51.def'\" unpacked with wrong size!
- fi
- # end of 'defs/epl3kf51.def'
- fi
- if test -f 'getsizes.PS' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'getsizes.PS'\"
- else
- echo shar: Extracting \"'getsizes.PS'\" \(3336 characters\)
- sed "s/^X//" >'getsizes.PS' <<'END_OF_FILE'
- X%!
- X% getsizes.ps
- X%
- X% Tony Field, tony@ajfcal.cuc.ab.ca
- X%
- X% Attempt to print out the imageable area for all known page sizes
- X% in the printer. Print the results on the printer's default paper
- X% size. If a different size should be used, modify the "statusdict
- X% begin lettertray end" line below.
- X%
- X% This file should be used only if a standard printer is not defined
- X% in the ./defs directory. If one is defined, then psizes.ps should
- X% be used instead.
- X%
- X% $Id: getsizes.PS,v 3.1 1991/11/27 06:02:58 ajf Exp ajf $
- X% ----------------------------------------------------------------
- X
- X% place current page information on the stack
- X
- X/getsize
- X{ /nf nf 1 add def % count page sizes
- X clippath % current path becomes clip path
- X pathbbox % put current path llx, lly, urx, ury on stack
- X} def
- X
- X% print the comment, and imageable area coordinates
- X
- X/sendsize
- X{ /ury exch def
- X /urx exch def
- X /lly exch def
- X /llx exch def
- X /str 64 string def
- X show % first print "Letter: 612 792" as commentary
- X ( ) show % then real imageable area for current size
- X % numbers are translated to integer
- X llx ceiling cvi str cvs show
- X ( ) show
- X lly ceiling cvi str cvs show
- X ( ) show
- X urx floor cvi str cvs show
- X ( ) show
- X ury floor cvi str cvs show
- X} def
- X
- X/newline % new line, delta = 15 points
- X{ /ycoord ycoord -15 add def
- X 50 ycoord moveto
- X} def
- X
- X
- X
- X/pg save def
- X
- Xnewpath
- X/nf 0 def % count of paper sizes found
- X
- X% look for any "standard" paper sizes. The expression
- X% (Tabloid: 616 729) is a comment that is printed. The "Tabloid"
- X% is the name of the paper size, "616" is the physical paper width
- X% in points, and "729" is the physical paper height in points.
- X% (points = inches * 72)
- X
- X% The paper dimensions for a given paper size are not always
- X% consitent for all printers!
- X
- Xcurrentdict /executive known {
- X executive
- X (executive: 522 756) getsize
- X} if
- Xcurrentdict /tabloid known {
- X tabloid
- X (tabloid: 792 1224) getsize
- X} if
- Xcurrentdict /statement known {
- X statement
- X (statement: 396 612) getsize
- X} if
- Xcurrentdict /note known {
- X note
- X (note: 612 792) getsize
- X} if
- Xcurrentdict /ledger known {
- X ledger
- X (ledger: 1224 792) getsize
- X} if
- Xcurrentdict /b5 known {
- X b5
- X (b5: 516 729) getsize
- X} if
- Xcurrentdict /b4 known {
- X b4
- X (b4: 729 1032) getsize
- X} if
- Xcurrentdict /a5 known {
- X a5
- X (a5: 420 595) getsize
- X} if
- Xcurrentdict /a4small known {
- X a4small
- X (a4small: 595 842) getsize
- X} if
- Xcurrentdict /a4 known {
- X a4
- X (a4: 595 842) getsize
- X} if
- Xcurrentdict /a3 known {
- X a3
- X (a3: 842 1190) getsize
- X} if
- Xcurrentdict /legal known {
- X legal
- X (legal: 612 1008) getsize
- X} if
- Xcurrentdict /letter known {
- X letter
- X (letter: 612 792) getsize
- X} if
- X
- X% statusdict begin lettertray end % modify for your "normal" output size
- X % or the line below
- X%letter
- X
- X% print out the header
- X
- X/Courier findfont 12 scalefont setfont
- X/ycoord 500 def
- Xnewline
- X(Imageable area for) show
- Xnewline
- X(your personal printer with psf) show
- Xnewline
- X( Physical Lower Upper) show
- Xnewline
- X(Size width height x y x y) show
- Xnewline
- X(--------- ------------ ------- ---------) show
- X
- X% print each found paper size coordinates from the stack
- X
- X{ newline
- X sendsize
- X /nf nf 1 sub def
- X nf 0 eq { exit } if
- X} loop
- X
- Xshowpage
- Xpg restore
- END_OF_FILE
- if test 3336 -ne `wc -c <'getsizes.PS'`; then
- echo shar: \"'getsizes.PS'\" unpacked with wrong size!
- fi
- # end of 'getsizes.PS'
- fi
- if test -f 'language.PSF' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'language.PSF'\"
- else
- echo shar: Extracting \"'language.PSF'\" \(7525 characters\)
- sed "s/^X//" >'language.PSF' <<'END_OF_FILE'
- X%%PsfStart
- X
- X$Id: language.PSF,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X
- X WARNING: This file must be edited to cause valid selection
- X ======= of postscript characters for non-English languages.
- X The sample "Scandinavian" translation table is
- X used for testing purposes only and will not generate
- X correct character selections. Read the comments in
- X the "%%translate" section below to manually create
- X a valid translation table and language character
- X vector for the target language.
- X
- X This is an example language startup file that illustrates
- X encoding of a font vector to use Scandinavian characters. This
- X file must be appended to the end of "psfprint.def" with
- X
- X cat psfprint.old.def language.PSF > psfprint.def
- X
- X The comments may remain in the final file, or may be removed as
- X desired - they are ignored by psf and friends.
- X
- X To set this code up for a different language, edit the lines
- X prefixed with "%%font" and "%%translate". Then modify the
- X section of postscript code following "ENCODE".
- X
- X The first section of the code must start with "%%PsfStart" and
- X terminate with %%PsfEnd. The information within this section
- X contains new font defintion and character translation tables.
- X This section may be empty, however the "%%PsfStart" and
- X "%%PsfEnd" lines must exist.
- X
- X This section is setup information processed by psf and psfbanner.
- X
- X Any postscript code following the "%%PsfEnd" marker is copied to
- X the printer as part of the postscript prologue.
- X
- X The key words %%PsfStart, %%fontX %%translate %%copy %%PsfEnd
- X must start in the first column of this file.
- X
- X ((( It might be possible to adapt this file to re-encode an
- X entire font for a different character set such as EBCDIC. Refer
- X to Adobe's Blue Book program #17 for hints on how this might be
- X accomplished. Entries for %%fontX would be needed, %%translate
- X would not be needed, and the postscript code after %%PsfEnd
- X would have to be replaced. )))
- X --------------------------------------------------------------
- X
- X Set up new language font names. Fonts in psf are numbered
- X as 0..9, a..z. The "%%fontX" numbers (where 'X' represents the
- X font number used by psf) reflect the font to be updated or
- X added. If a font is not updated in the list below, the original
- X font remains.
- X
- X The following are the standard fonts known to psf:
- X
- X # name # name
- X - ------------------- - -------------------------
- X 0 Courier 1 Helvetica
- X 2 Times-Roman 3 AvantGarde-Book
- X 4 Bookman-Light 5 NewCenturySchlbk-Roman
- X 6 Palatino-Roman 7 Helvetical-Narrow
- X 8 Garamond-Light 9 Korinna-Regular
- X a Helvetica-Condensed b ZapfChancery-MediumItalic
- X
- X This example REPLACES standard Courier (%%font0) to become a
- X Scandinavian equivalent for the default Courier font and add a
- X NEW font (%%fontc) to be the Scandinavian encoded version of
- X Times-Roman. New fonts should be numbered starting from "c". DO
- X NOT leave gaps when adding new font numbers, add c, d, e, ... in
- X sequence.
- X
- X New font definitions will appear with "psf -".
- X
- X The format of the %%fontX lines must always follow the pattern
- X below - the new names created must be for the base, italic,
- X bold and bold-italic, in order. The new font names are
- X arbitrary, however must match the names later in the ENCODE
- X section.
- X
- X font new base font new italic font new bold font new bold-italic
- X # -------------- ------------------- ---------------- ---------------------
- X%%font0 Courier-S Courier-Oblique-S Courier-Bold-S Courier-BoldOblique-S
- X%%fontc Times-S Times-I-S Times-B-S Times-BI-S
- X ------------------------------------------------------------------
- X
- X The following translates the letters from 'a' .. 't' to a series
- X of characters that could be used in a Scandinavian language.
- X Printing a file containing:
- X
- X abcdefghijklmnopqrst
- X
- X causes each 'English' letter to be replaced by an arbitrary
- X special 'Scandanavian' letter.
- X
- X The translation table format is:
- X
- X <ascii text value> / <postscript value>
- X e.g.:
- X 141/300 translates "a" to "/Oacute"
- X
- X where 141 = "a", 300 = "/Oacute"
- X
- X The <ascii text value> is the octal value of a text character
- X that actually appears in the text file. The <postscript value>
- X is the octal value to which it is to be translated. This new
- X value is set up in the "languagevec" array below.
- X
- X On SysV unix, the <ascii text value>s are (may be?) determined
- X from the ttymap(1) table for the target language.
- X
- X Of course, this table is not "real", it is an example only -
- X used for testing! Replace this with real translation
- X information.
- X
- X%%translate 141/300 142/311 143/321 144/322 145/323 146/324 147/325 150/330
- X%%translate 151/331 152/332 153/333 154/334 155/340 156/342 157/344 160/347
- X%%translate 161/360 162/362 163/364 164/367
- X ----------------------------------------------------------------
- X
- X An external file may be copied to the printer with "%%copy file"
- X This file is inserted into the "prologue" code. It must be
- X postscript.
- X
- X %%copy /etc/some.file
- X
- X%%PsfEnd
- X
- X
- X% Psf and psbanner add the following code to the Prologue
- X%
- X% The following postscript code is from:
- X% Adobe Postscript Language Tutorial and Cookbook
- X% Blue book program 18, page 211.
- X% Making small changes to encoding vectors
- X%
- X
- X/reencsmalldict 12 dict def
- X/ReEncodeSmall
- X {reencsmalldict begin
- X /newcodesandnames exch def
- X /newfontname exch def
- X /basefontname exch def
- X /basefontdict basefontname findfont def
- X /newfont basefontdict maxlength dict def
- X basefontdict
- X { exch dup /FID ne
- X {dup /Encoding eq
- X { exch dup length array copy
- X newfont 3 1 roll put }
- X { exch newfont 3 1 roll put }
- X ifelse
- X }
- X { pop pop }
- X ifelse
- X } forall
- X
- X newfont /FontName newfontname put
- X newcodesandnames aload pop
- X
- X newcodesandnames length 2 idiv
- X { newfont /Encoding get 3 1 roll put }
- X repeat
- X
- X newfontname newfont definefont pop
- X end
- X } def
- X
- X% Select the additional characters needed for the desired language.
- X% "languagevec" below is set up as a Scandinavian character set
- X% assignment. Other languages will need a different selection.
- X
- X/languagevec [
- X 8#300 /Oacute
- X 8#311 /Adieresis
- X 8#321 /oacute
- X 8#322 /Ograve
- X 8#323 /Scaron
- X 8#324 /ograve
- X 8#325 /scaron
- X 8#330 /Edieresis
- X 8#331 /adieresis
- X 8#332 /edieresis
- X 8#333 /Odieresis
- X 8#334 /odieresis
- X 8#340 /Aacute
- X 8#342 /Aring
- X 8#344 /Zcaron
- X 8#347 /Eacute
- X 8#360 /aacute
- X 8#362 /aring
- X 8#364 /zcaron
- X 8#367 /eacute
- X ] def
- X
- X% ENCODE the new fonts for Scandinavian. Then new font name must
- X% have been defined in the "%%fontX" lines above.
- X%
- X% base font new font name reencode the new font
- X% ----------------- --------------------- -------------------------
- X/Courier /Courier-S languagevec ReEncodeSmall
- X/Courier-Oblique /Courier-Oblique-S languagevec ReEncodeSmall
- X/Courier-Bold /Courier-Bold-S languagevec ReEncodeSmall
- X/Courier-BoldOblique /Courier-BoldOblique-S languagevec ReEncodeSmall
- X/Times-Roman /Times-S languagevec ReEncodeSmall
- X/Times-Italic /Times-I-S languagevec ReEncodeSmall
- X/Times-Bold /Times-B-S languagevec ReEncodeSmall
- X/Times-BoldItalic /Times-BI-S languagevec ReEncodeSmall
- END_OF_FILE
- if test 7525 -ne `wc -c <'language.PSF'`; then
- echo shar: \"'language.PSF'\" unpacked with wrong size!
- fi
- # end of 'language.PSF'
- fi
- if test -f 'man/psfbs.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man/psfbs.1'\"
- else
- echo shar: Extracting \"'man/psfbs.1'\" \(3529 characters\)
- sed "s/^X//" >'man/psfbs.1' <<'END_OF_FILE'
- X.\" $Id: psfbs.1,v 3.1 1991/11/27 06:10:44 ajf Exp ajf $
- X.TH PSFBS 1 ""
- X.SH NAME
- Xpsfbs \- postscript nroff backspace filter for use with psf
- X
- X.SH SYNOPSIS
- X.B psfbs
- X[
- X.B -i
- X] [
- X.B -f
- X] [
- X.B -l
- X.I n
- X] [
- X.B -r
- X.I n
- X]
- X.I file ... > out.fil
- X.nf
- X
- Xwhere -i = use italic font instead of underline
- X -f = document has formfeeds, ignore line count
- X -l n = nroff generated "n" ine pages
- X (default = 66 lines)
- X -r n = number of lines to remove (default = 3)
- X file = input files (or stdin)
- X.fi
- X
- X.SH DESCRIPTION
- X
- X.I Psfbs
- Xis a filter that converts "backspaced text" generated by
- X.I nroff
- Xinto underlined or bold text. It is primarily used
- Xto format
- X.I man
- Xpages, however it can be used to format documents
- Xgenerated with the
- X.I ms
- Xand
- X.I mm
- Xmacros.
- X
- XNormally,
- X.I psfbs
- Xis not used directly: the shell script
- X.I psfnroff
- Xis a more convenient interface for
- X.I nroff
- Xtext formatting.
- X
- XNroff'ed documents typically use 66 line pages. Since
- X.I psf
- Xdefaults to 63 lines on Letter size paper (3 lines are unprintable), three
- Xblank lines are usually removed between nroff'ed pages.
- X
- X.SH EXAMPLES
- X
- XThe man page for "psf" man page could be printed "2-up" with:
- X
- X.nf
- X nroff -man psf.1 | psfbs -r 3 | psf -2 | lp
- X
- Xor 1-up with with italic conversion
- X
- X nroff -man psf.1 | psfbs -ir 3 | psf -2 | lp
- X.fi
- X
- X.SH OPTIONS
- X
- X.TP .9i
- X.B \-i
- XSince the text from
- X.I nroff
- Xusually substitutes underlines for
- Xitalics, you may use the -i option to regenerate the italic font.
- X
- X.RE
- X.TP .9i
- X.B \-f
- XIf the document uses form feeds for page separation, the -f option
- Xshould be specified. Any line count specified by -l is ignored.
- X
- X.RE
- X.TP .9i
- X.B \-l n
- XThe -l option specifies the nominal number of lines generated by
- X.I nroff
- Xfor the page. If the -l option is used, the -r option probably must
- Xbe specified also.
- X
- XIf "-l" is not specified, then 66 line nroff pages are assumed.
- X
- X.RE
- X.TP .9i
- X.B \-r n
- XThe -r option allows you to specify the number blank lines to be
- Xremoved between each page generated by nroff.
- XIf "-r" is not specified, then 3 blank lines are removed between pages.
- X
- XThe removed lines account for the "unprintable" top an bottom
- Xareas of the postscript page.
- X
- XLines may be removed by
- X.I psfbs
- Xor by
- X.I psf
- Xwhich also has a
- X.I -r
- Xoption. If line removal is performed by
- X.I psf,
- Xthen the option
- X.B -r0
- Xshould be used with
- X.I psfbs
- Xto disable the removal of the 3 default blank lines.
- X
- X.SH PSFBS NOTES
- X
- X.I Psfbs
- Xconverts "backspaced text" generated by
- X.I nroff
- Xinto escape sequences
- Xthat can be used by psf to generate underlined or bold text.
- XIt simply scans for the "backspace" character and
- Xattempts determine if the backspace is used in the contex of an "underline"
- Xor "multi-strike boldface". In some circumstances, it may not correctly
- Xdetect the print operation (for example, italic-bold is not recognized).
- X
- XThe conversion results in the following generated sequences that can
- Xbe recognized by
- X.I psf
- X(were ^E is <ctrl>E or the octal value \\005):
- X.nf
- X
- X ^EB..text..^Eb for bold
- X ^EU..text..^Eu for underline
- Xor
- X ^EI..text..^Ei for italics
- X
- X(italics instead of underline selected with -i option)
- X
- X.fi
- XThe logic cannot handle bold-underlined (nor italic-underlined).
- X
- X.SH BUGS
- X
- X.I Psfbs
- Xis not a full featured
- X.I nroff
- Xfilter. It is intended to process documents generated
- Xwith the
- X.I -man
- Xmacros. Formatting with other macros may be incorrectly handled.
- X
- X.SH SEE ALSO
- Xpsf psfman psfnroff psfdoub
- X
- X.SH AUTHOR
- X
- XTony Field. tony@ajfcal.cuc.ab.ca
- END_OF_FILE
- if test 3529 -ne `wc -c <'man/psfbs.1'`; then
- echo shar: \"'man/psfbs.1'\" unpacked with wrong size!
- fi
- # end of 'man/psfbs.1'
- fi
- if test -f 'man/psfbs.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man/psfbs.doc'\"
- else
- echo shar: Extracting \"'man/psfbs.doc'\" \(3824 characters\)
- sed "s/^X//" >'man/psfbs.doc' <<'END_OF_FILE'
- X
- X
- X
- X PSFBS(1) Unix System V PSFBS(1)
- X
- X
- X
- X NAME
- X psfbs - postscript nroff backspace filter for use with psf
- X
- X
- X SYNOPSIS
- X psfbs [ -i ] [ -f ] [ -l n ] [ -r n ] file ... > out.fil
- X
- X where -i = use italic font instead of underline
- X -f = document has formfeeds, ignore line count
- X -l n = nroff generated "n" ine pages
- X (default = 66 lines)
- X -r n = number of lines to remove (default = 3)
- X file = input files (or stdin)
- X
- X
- X DESCRIPTION
- X Psfbs is a filter that converts "backspaced text" generated
- X by nroff into underlined or bold text. It is primarily used
- X to format man pages, however it can be used to format
- X documents generated with the ms and mm macros.
- X
- X Normally, psfbs is not used directly: the shell script
- X psfnroff is a more convenient interface for nroff text
- X formatting.
- X
- X Nroff'ed documents typically use 66 line pages. Since psf
- X defaults to 63 lines on Letter size paper (3 lines are
- X unprintable), three blank lines are usually removed between
- X nroff'ed pages.
- X
- X
- X EXAMPLES
- X The man page for "psf" man page could be printed "2-up"
- X with:
- X
- X nroff -man psf.1 | psfbs -r 3 | psf -2 | lp
- X
- X or 1-up with with italic conversion
- X
- X nroff -man psf.1 | psfbs -ir 3 | psf -2 | lp
- X
- X
- X OPTIONS
- X -i Since the text from nroff usually substitutes
- X underlines for italics, you may use the -i option
- X to regenerate the italic font.
- X
- X
- X -f If the document uses form feeds for page
- X separation, the -f option should be specified. Any
- X line count specified by -l is ignored.
- X
- X
- X
- X
- X Page 1 (printed 1/18/92)
- X
- X
- X
- X
- X
- X
- X PSFBS(1) Unix System V PSFBS(1)
- X
- X
- X
- X -l n The -l option specifies the nominal number of lines
- X generated by nroff for the page. If the -l option
- X is used, the -r option probably must be specified
- X also.
- X
- X If "-l" is not specified, then 66 line nroff pages
- X are assumed.
- X
- X
- X -r n The -r option allows you to specify the number
- X blank lines to be removed between each page
- X generated by nroff. If "-r" is not specified, then
- X 3 blank lines are removed between pages.
- X
- X The removed lines account for the "unprintable" top
- X an bottom areas of the postscript page.
- X
- X Lines may be removed by psfbs or by psf which also
- X has a -r option. If line removal is performed by
- X psf, then the option -r0 should be used with psfbs
- X to disable the removal of the 3 default blank
- X lines.
- X
- X
- X PSFBS NOTES
- X Psfbs converts "backspaced text" generated by nroff into
- X escape sequences that can be used by psf to generate
- X underlined or bold text. It simply scans for the
- X "backspace" character and attempts determine if the
- X backspace is used in the contex of an "underline" or
- X "multi-strike boldface". In some circumstances, it may not
- X correctly detect the print operation (for example, italic-
- X bold is not recognized).
- X
- X The conversion results in the following generated sequences
- X that can be recognized by psf (were ^E is <ctrl>E or the
- X octal value \005):
- X
- X ^EB..text..^Eb for bold
- X ^EU..text..^Eu for underline
- X or
- X ^EI..text..^Ei for italics
- X
- X (italics instead of underline selected with -i option)
- X
- X The logic cannot handle bold-underlined (nor italic-
- X underlined).
- X
- X
- X BUGS
- X Psfbs is not a full featured nroff filter. It is intended to
- X process documents generated with the -man macros. Formatting
- X
- X
- X
- X Page 2 (printed 1/18/92)
- X
- X
- X
- X
- X
- X
- X PSFBS(1) Unix System V PSFBS(1)
- X
- X
- X
- X with other macros may be incorrectly handled.
- X
- X
- X SEE ALSO
- X psf psfman psfnroff psfdoub
- X
- X
- X AUTHOR
- X Tony Field. tony@ajfcal.cuc.ab.ca
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X Page 3 (printed 1/18/92)
- X
- X
- X
- END_OF_FILE
- if test 3824 -ne `wc -c <'man/psfbs.doc'`; then
- echo shar: \"'man/psfbs.doc'\" unpacked with wrong size!
- fi
- # end of 'man/psfbs.doc'
- fi
- if test -f 'man/psfdoub.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man/psfdoub.1'\"
- else
- echo shar: Extracting \"'man/psfdoub.1'\" \(3082 characters\)
- sed "s/^X//" >'man/psfdoub.1' <<'END_OF_FILE'
- X.\" $Id: psfdoub.1,v 3.1 1991/11/27 06:10:44 ajf Exp ajf $
- X.TH PSFDOUB 1 ""
- X.SH NAME
- Xpsfdoub \- print double sided (psf)
- X.SH SYNOPSIS
- X
- X.B psfdoub n
- X[
- X.B -u
- X.I f.def
- X] [
- X.B -v
- X]
- X.I file
- X.nf
- X
- Xwhere n is the number 1, 2, or 3
- X 1 = print first side
- X 2 = print second side
- X 3 = print both sides (must have second print tray)
- X -r = reverse order print
- X -u f.def = name of .def file to use
- X file = input file (default: psfbook.psd)
- X.fi
- X
- X.SH DESCRIPTION
- X
- XIf the postscript filter
- X.I psf
- Xis used with the -d (double sided)
- Xoption, the output file
- X.I psfbook.psd
- Xmust be passed to
- X.I psfdoub
- Xto print
- Xthe generated file in "double sided" format. (See NOTE below.)
- X
- XThe printing is done in two passes: first to print side one,
- Xsecond to print side two.
- X
- XThe general sequence of commands is be:
- X
- X.nf
- X psf -d my.file
- X psfdoub -1 psfbook.psd | lp
- X <-- re-feed the paper for 2nd pass
- X psfdoub -2 psfbook.psd | lp
- X.fi
- X
- X.I Psf
- Xgenerates the intermediate file
- X.I psfbook.psd.
- XThe first invocation of
- X.I psfdoub
- Xwith the -1 option prints only the front side
- Xof the pages. After the printing is complete, the paper must be
- Xre-fed into the print hopper. The psfdoub -2 command is then issued to print
- Xon the back side of the pages.
- X
- XIf
- X.I psfdoub
- Xis used with the -3 option, the front sides are printed. Automatically,
- Xthe printer is switched to accept input from the alternate print tray.
- XAs soon as the alternate print tray is loaded, the second side is printed.
- XE.g.:
- X.nf
- X psf -d my.file
- X psfdoub -3 psfbook.psd | lp
- X.fi
- X
- XThe -3 option may be used only if the printer has two print trays.
- X
- X.SH OPTIONS
- X.TP
- X.B -123
- Xsets the desired page size for printing. See above.
- X
- X.TP
- X.B -r
- Xcauses the pages to be printed in reverse order.
- X
- X.TP
- X.B -u f.def
- Xcauses the specified printer definition file to be used rather
- Xthat
- X.I psfprint.def.
- X
- X.TP
- X.B file
- Xis the name of the file to be processed. The file name
- Xgenerated by
- X.I psf
- Xis
- X.I psfbook.psd.
- XIf an input file name is not provided, the
- X.I psfbook.psd
- Xis assumed.
- X
- X.SH NOTE
- X
- XIf
- X.I psf
- Xwas compiled with the "-DHOPPER" option and the postscript printer
- Xhas at least two paper hoppers,
- X.I psf
- Xautomatically calls
- X.I psfdoub
- Xto perform
- Xdouble sided printing. Manual invocation of
- X.I psfdoub
- Xis not necessary.
- X
- XIf
- X.I psf
- Xwas not compiled with "-DHOPPER" or if the postscript printer does
- Xnot have at least two paper hoppers, then
- X.I psfdoub
- Xmust be used as described
- Xabove.
- X
- XThe use of option "-3" assumes that
- X.I psf
- Xwas compiled
- X.B without
- Xthe "-DHOPPER"
- Xoption, however the printer does, in fact, have at least two paper
- Xhoppers.
- X
- XExamine shell script
- X.I psfdouble
- Xas an example on setting up suitable shell scripts
- Xfor double sided printing.
- X
- X.I Psfdoub is also used by
- X.I psf
- Xfor reverse order printing.
- X
- X.SH BUGS
- XDouble sided reverse ordered printing is not supported.
- X
- X.SH FILES
- X.nf
- Xpsfprint.def - printer definition file
- Xpsfbook.psd - file to be processed by psfdoub
- X.fi
- X
- X.SH SEE ALSO
- X
- Xpsf psfmbox psfmail psfbs psfman psfnroff
- END_OF_FILE
- if test 3082 -ne `wc -c <'man/psfdoub.1'`; then
- echo shar: \"'man/psfdoub.1'\" unpacked with wrong size!
- fi
- # end of 'man/psfdoub.1'
- fi
- if test -f 'man/psfdoub.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man/psfdoub.doc'\"
- else
- echo shar: Extracting \"'man/psfdoub.doc'\" \(3198 characters\)
- sed "s/^X//" >'man/psfdoub.doc' <<'END_OF_FILE'
- X
- X
- X
- X PSFDOUB(1) Unix System V PSFDOUB(1)
- X
- X
- X
- X NAME
- X psfdoub - print double sided (psf)
- X
- X SYNOPSIS
- X psfdoub n [ -u f.def ] [ -v ] file
- X
- X where n is the number 1, 2, or 3
- X 1 = print first side
- X 2 = print second side
- X 3 = print both sides (must have second print tray)
- X -r = reverse order print
- X -u f.def = name of .def file to use
- X file = input file (default: psfbook.psd)
- X
- X
- X DESCRIPTION
- X If the postscript filter psf is used with the -d (double
- X sided) option, the output file psfbook.psd must be passed to
- X psfdoub to print the generated file in "double sided"
- X format. (See NOTE below.)
- X
- X The printing is done in two passes: first to print side
- X one, second to print side two.
- X
- X The general sequence of commands is be:
- X
- X psf -d my.file
- X psfdoub -1 psfbook.psd | lp
- X <-- re-feed the paper for 2nd pass
- X psfdoub -2 psfbook.psd | lp
- X
- X Psf generates the intermediate file psfbook.psd. The first
- X invocation of psfdoub with the -1 option prints only the
- X front side of the pages. After the printing is complete,
- X the paper must be re-fed into the print hopper. The psfdoub
- X -2 command is then issued to print on the back side of the
- X pages.
- X
- X If psfdoub is used with the -3 option, the front sides are
- X printed. Automatically, the printer is switched to accept
- X input from the alternate print tray. As soon as the
- X alternate print tray is loaded, the second side is printed.
- X E.g.:
- X psf -d my.file
- X psfdoub -3 psfbook.psd | lp
- X
- X The -3 option may be used only if the printer has two print
- X trays.
- X
- X
- X OPTIONS
- X -123 sets the desired page size for printing. See above.
- X
- X
- X
- X Page 1 (printed 1/18/92)
- X
- X
- X
- X
- X
- X
- X PSFDOUB(1) Unix System V PSFDOUB(1)
- X
- X
- X
- X -r causes the pages to be printed in reverse order.
- X
- X
- X -u f.def
- X causes the specified printer definition file to be used
- X rather that psfprint.def.
- X
- X
- X file is the name of the file to be processed. The file name
- X generated by psf is psfbook.psd. If an input file name
- X is not provided, the psfbook.psd is assumed.
- X
- X
- X NOTE
- X If psf was compiled with the "-DHOPPER" option and the
- X postscript printer has at least two paper hoppers, psf
- X automatically calls psfdoub to perform double sided
- X printing. Manual invocation of psfdoub is not necessary.
- X
- X If psf was not compiled with "-DHOPPER" or if the postscript
- X printer does not have at least two paper hoppers, then
- X psfdoub must be used as described above.
- X
- X The use of option "-3" assumes that psf was compiled without
- X the "-DHOPPER" option, however the printer does, in fact,
- X have at least two paper hoppers.
- X
- X Examine shell script psfdouble as an example on setting up
- X suitable shell scripts for double sided printing.
- X
- X Psfdoub is also used by psf for reverse order printing.
- X
- X
- X BUGS
- X Double sided reverse ordered printing is not supported.
- X
- X
- X FILES
- X psfprint.def - printer definition file
- X psfbook.psd - file to be processed by psfdoub
- X
- X
- X SEE ALSO
- X psf psfmbox psfmail psfbs psfman psfnroff
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X Page 2 (printed 1/18/92)
- X
- X
- X
- END_OF_FILE
- if test 3198 -ne `wc -c <'man/psfdoub.doc'`; then
- echo shar: \"'man/psfdoub.doc'\" unpacked with wrong size!
- fi
- # end of 'man/psfdoub.doc'
- fi
- if test -f 'psfbs.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'psfbs.c'\"
- else
- echo shar: Extracting \"'psfbs.c'\" \(6098 characters\)
- sed "s/^X//" >'psfbs.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/****************************************************************************
- X* p s f b s . c *
- X* *
- X* postscript filter for nroff'ed text *
- X* *
- X* Translate backspaces in nroff documents to either BOLD or UNDERLINE *
- X* for psf usage *
- X* *
- X* Tony Field. tony@ajfcal.cuc.ab.ca *
- X****************************************************************************/
- X/*
- X * $Id: psfbs.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X */
- X
- X/* For each line in of input text, scan for backspaces. Determine if
- X the operation is an underline (i.e. the preceeding character is
- X the "_") or if it is a bolding (the character after the underscore
- X is the same as the preceeding.
- X
- X Generate the sequence \005B..text..\005b for bold
- X \005U..text..\005u for underline
- X \005I..text..\005i for italics
- X
- X Since the text from nroff does not have a decent way of identifying
- X italics, you may make the decision to generate the "italic" or
- X "underline" escape sequence whenever an underline is detected in
- X the output. Italic fonts look nicer than the underlines 2-up.
- X
- X The logic cannot handle bold-underlined (nor italic-underlined).
- X This could be done with a bit of extra logic to manipulate bits
- X in the "how" vector.
- X
- X For nroff, remove three blank lines between pages (an nroff'ed
- X document, letter size, has 66 lines. the postscript
- X printer must see 63 lines.) Assume that nroff is consistent.
- X If "point size" adjustments are made (e.g. some documents
- X originally intended for troff), then lines per page may not
- X be consistent.
- X
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include "psf.h"
- X#include "patchlevel.h"
- X
- Xchar *pgmname;
- XFILE *outfp;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int i, c;
- X int nroff_lines = 66;
- X int remove = 3;
- X int count_lines = 1;
- X char *underline_on, *underline_off;
- X extern char *optarg;
- X extern int optind, getopt();
- X FILE *input_fp;
- X
- X outfp = stdout;
- X pgmname = argv[0];
- X underline_on = BEGIN_UNDERLINE;
- X underline_off = END_UNDERLINE;
- X
- X if (strcmp (argv[1], "-") == 0)
- X usage();
- X while ((c = getopt(argc, argv, "ifr:l:-")) != -1)
- X { switch (c)
- X {
- X case 'i':
- X underline_on = BEGIN_ITALICS;
- X underline_off = END_ITALICS;
- X break;
- X
- X case 'l':
- X nroff_lines = atoi (optarg);
- X break;
- X
- X case 'r':
- X remove = atoi (optarg);
- X break;
- X
- X case 'f':
- X count_lines = 0;
- X break;
- X
- X default:
- X usage ();
- X }
- X }
- X
- X if (optind >= argc)
- X { input_fp = stdin;
- X print_file (input_fp, nroff_lines, remove, underline_on, underline_off, count_lines);
- X }
- X else
- X {
- X for (i = 0 ; optind < argc; optind++)
- X { if ((input_fp = fopen (argv[optind], "r")) == NULL)
- X { fprintf (stderr, "%s: File %s not found\n", pgmname, argv[optind]);
- X }
- X else
- X { if (i)
- X send ("\f");
- X print_file (input_fp, nroff_lines, remove, underline_on, underline_off, count_lines);
- X fclose (input_fp);
- X i++;
- X }
- X }
- X }
- X exit (0);
- X
- X}
- X
- Xprint_file (fp, nroff_lines, remove, underline_on, underline_off, count_lines)
- XFILE *fp;
- Xint nroff_lines;
- Xint remove;
- Xint count_lines;
- Xchar *underline_on, *underline_off;
- X{
- X int c, n, i;
- X int how[401];
- X char line[401];
- X int nroff_count;
- X
- X nroff_count = n = 0;
- X
- X clear (line, how, 400);
- X while (( c = fgetc (fp)) != EOF)
- X {
- X if (c == '\033') /* if ^[ (real ESCAPE character), then handle (sort of) */
- X { if ((c = fgetc (fp)) == EOF)
- X break;
- X if (c == '9') /* 1/2 line space fwd */
- X { fputc (ESCAPE, outfp);
- X fputc ('+', outfp);
- X nroff_count += 5;
- X continue;
- X }
- X else if (c == '8') /* 1/2 line space back */
- X { fputc (ESCAPE, outfp);
- X fputc ('-', outfp);
- X nroff_count -= 5;
- X continue;
- X }
- X else
- X { /* don't know what to do with it */
- X continue;
- X }
- X }
- X
- X else if (c == '\b')
- X n--;
- X else if (c == '\n')
- X { if (count_lines)
- X { /* remove 3 blank lines between pages
- X 1 from beginning of page,
- X 2 from end of page.
- X */
- X nroff_count = (nroff_count + 10) % (nroff_lines * 10);
- X if (nroff_count < 20 || nroff_count > (nroff_lines - (remove-1)) * 10)
- X continue;
- X }
- X how[n] = 0;
- X line[n] = 0;
- X for (i = 0; i <= n; i++)
- X {
- X if (how[i])
- X { /* either bold or underlined see if previous char
- X is not escaped - indicates the beginning of
- X an escape sequence. may need to terminate
- X previous sequence first (e.g. bold followed
- X by underlined).
- X */
- X if (i > 0 && how[i-1] && (how[i] != how[i-1]))
- X { if (how[i-1] == 1)
- X send (END_BOLD);
- X else
- X send (underline_off);
- X }
- X if (how[i] == 1 && (i == 0 || how[i-1] != 1))
- X send (BEGIN_BOLD);
- X else if (how[i] == 2 && (i == 0 || how[i-1] != 2))
- X send (underline_on);
- X }
- X else /* zero means just a character, unmodified */
- X { /* are we at the end of an escape sequence? */
- X if (i > 0)
- X { if (how[i-1] == 1)
- X send (END_BOLD);
- X else if (how[i-1] == 2)
- X send (underline_off);
- X }
- X }
- X if (line[i])
- X fputc (line[i], outfp);
- X }
- X fputc ('\n', outfp);
- X clear (line, how, n);
- X n = 0;
- X }
- X else
- X { if (line[n])
- X { if (line[n] == c) /* same character? */
- X how[n] = 1; /* yes: bold */
- X else
- X how[n] = 2; /* no: underline */
- X }
- X if (line[n] == 0 || c != '_')
- X line[n] = c;
- X n++;
- X }
- X }
- X}
- X
- Xclear (line, how, n)
- Xchar *line;
- Xint *how;
- Xint n;
- X{
- X int i;
- X
- X for (i = 0; i <= n; i++)
- X { line[i] = '\0';
- X how[i] = 0;
- X }
- X}
- X
- Xsend (s)
- Xchar *s;
- X{
- X while (*s)
- X fputc (*s++, outfp);
- X}
- X
- Xusage ()
- X{
- X fprintf (stderr, "Usage: psfbs [-i] [ -f ] [ -l n ] [ -r n ] file ... >out.file\n");
- X fprintf (stderr, " where -i = use italics in lieu of underline\n");
- X fprintf (stderr, " -f = document has form feeds, ignore line count\n");
- X fprintf (stderr, " -l n = make n line nroff'ed documents fit\n");
- X fprintf (stderr, " -r n = number of blank lines to remove\n");
- X fprintf (stderr, " file = input files (or stdin)\n");
- X exit (0);
- X}
- END_OF_FILE
- if test 6098 -ne `wc -c <'psfbs.c'`; then
- echo shar: \"'psfbs.c'\" unpacked with wrong size!
- fi
- # end of 'psfbs.c'
- fi
- if test -f 'psfmail.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'psfmail.c'\"
- else
- echo shar: Extracting \"'psfmail.c'\" \(6468 characters\)
- sed "s/^X//" >'psfmail.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/****************************************************************************
- X* p s f m a i l . c *
- X* *
- X* postscript mail filter *
- X* *
- X* very simple mail filter to print name and subject in bold letters *
- X* for psf usage. Generates escape sequences that psf can understand. *
- X* Modify the code if you wish to have various headers ignored for print. *
- X* *
- X* Tony Field. tony@ajfcal.cuc.ab.ca *
- X****************************************************************************/
- X/*
- X * $Id: psfmail.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <ctype.h>
- X#include "patchlevel.h"
- X#include "psf.h"
- X
- X#define MAX_C 62 /* max char wrap point on mail header line */
- X
- Xchar *pgmname;
- X
- XFILE *outfp;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{
- X int ignore_garbage, i;
- X extern char *optarg;
- X extern int optind;
- X FILE *input_fp;
- X
- X outfp = stdout;
- X pgmname = argv[0];
- X ignore_garbage = 1;
- X if (strcmp (argv[1], "-") == 0)
- X usage();
- X while ((i = getopt(argc, argv, "s-")) != -1)
- X { switch (i)
- X {
- X case 's':
- X ignore_garbage = 0; /* print all headers */
- X break;
- X
- X default:
- X usage ();
- X }
- X }
- X if (optind >= argc)
- X { input_fp = stdin;
- X print_file (input_fp, ignore_garbage);
- X }
- X else
- X {
- X for ( i = 0; optind < argc; optind++)
- X { if ((input_fp = fopen (argv[optind], "r")) == NULL)
- X { fprintf (stderr, "%s: File %s not found\n", pgmname, argv[optind]);
- X }
- X else
- X { if (i)
- X send ("\f");
- X print_file (input_fp, ignore_garbage);
- X fclose (input_fp);
- X i++;
- X }
- X }
- X }
- X exit (0);
- X}
- X
- Xprint_file (fp, ignore_garbage)
- XFILE *fp;
- Xint ignore_garbage;
- X{
- X char line[900], first[100], tail[800], *strchr();
- X int last_char, header, garbage;
- X
- X header = garbage = 0;
- X while (fgets (line, 999, fp) != NULL)
- X {
- Xnewmail:
- X last_char = split (line, first, tail);
- X
- X /* The following headers will be ignored during printing */
- X
- X if (ignore_garbage
- X && (strcmp (first, "Distribution:" ) == 0
- X || strcmp (first, "Keywords:" ) == 0
- X || strcmp (first, "Lines:" ) == 0
- X || strcmp (first, "Message-ID:" ) == 0
- X || strcmp (first, "Message-Id:" ) == 0
- X || strcmp (first, "News-Path:" ) == 0
- X || strcmp (first, "Path:" ) == 0
- X || strcmp (first, "Posted:" ) == 0
- X || strcmp (first, "Received:" ) == 0
- X || strcmp (first, "References:" ) == 0
- X || strcmp (first, "Sender:" ) == 0
- X || strcmp (first, "Status:" ) == 0
- X || strncmp(first, "X-", 2 ) == 0))
- X { garbage = 1;
- X }
- X else if (strcmp (first, "From") == 0)
- X { printclean (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "From:") == 0
- X || strcmp (first, "Reply-To:") == 0
- X || strcmp (first, "To:") == 0)
- X { header = 1;
- X if ((strchr (tail, '(') == NULL) && (strchr (tail, '<') == NULL))
- X printbold (first, tail);
- X else
- X printname (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "Bcc:") == 0 || strcmp (first, "Cc:") == 0)
- X { header = 1;
- X printname (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "Subject:") == 0)
- X { printsubject (first, tail);
- X garbage = 0;
- X }
- X else if (last_char == ':')
- X {
- X header = 1;
- X printclean (first, tail);
- X garbage = 0;
- X }
- X else if (empty (line))
- X {
- X send ("\n");
- X while (fgets (line, 999, fp) != NULL)
- X { if (strncmp (line, "From ", 5) == 0
- X && (strchr (line, ':') < strrchr (line, ':')))
- X { send ("\f");
- X goto newmail; /* goto's considered harmful since 1964 */
- X }
- X printf ("%s", line);
- X }
- X break;
- X }
- X else if (garbage == 0)
- X printclean (" ", line);
- X }
- X}
- X
- Xprintclean (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X printlong (tail);
- X}
- X
- Xprintlong (tail)
- Xchar *tail;
- X{ char *c;
- X int marks[100], nmarks, i, j, nchar;
- X
- X /* locate all marks that can be use for a line break */
- X
- X marks[0] = 0;
- X marks[1] = 0;
- X c = tail;
- X for ( i = nchar = 0, nmarks = 1; nmarks < 100; i++, c++, nchar++)
- X {
- X if (*c == '!' || *c == ' ' || *c == '<'
- X || *c == '(' || *c == '\0')
- X { if (nchar < MAX_C)
- X marks[nmarks] = i;
- X else
- X { nchar = i - marks[nmarks];
- X marks[++nmarks] = i;
- X }
- X if (*c == '\0')
- X break;
- X }
- X }
- X marks[nmarks] = i;
- X for (i = 0; i < nmarks; i++)
- X {
- X if (i)
- X printf ("%-14s", " ");
- X for (j = marks[i]; j < marks[i+1]; j++)
- X fputc (tail[j], outfp);
- X fputc ('\n', outfp);
- X }
- X}
- X
- Xprintsubject (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X send (BEGIN_SUBJECT);
- X send (tail);
- X send (END_SUBJECT);
- X send ("\n");
- X}
- X
- Xprintbold (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X send (BEGIN_BOLD);
- X printlong (tail);
- X send (END_BOLD);
- X}
- X
- Xprintname (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X
- X if (strchr (tail, '<') != NULL)
- X { /* address syntax "name <address> stuff" */
- X send (BEGIN_NAME);
- X while (*tail != '<')
- X fputc (*tail++, outfp);
- X send (END_NAME);
- X fputc (*tail++, outfp);
- X while (*tail)
- X { fputc (*tail, outfp);
- X if (*tail++ == '>')
- X { if (*tail)
- X { send (BEGIN_NAME);
- X while (*tail)
- X fputc (*tail++, outfp);
- X send (END_NAME);
- X }
- X }
- X }
- X }
- X else
- X { /* address syntax "address (name)" */
- X while (*tail && *tail != '(')
- X fputc (*tail++, outfp);
- X if (*tail)
- X { send (BEGIN_NAME);
- X fputc (*tail++, outfp);
- X while (*tail)
- X { fputc (*tail, outfp);
- X if (*tail++ == ')')
- X { send (END_NAME);
- X while (*tail)
- X fputc (*tail++, outfp);
- X fputc ('\n', outfp);
- X return;
- X }
- X }
- X }
- X }
- X fputc ('\n', outfp);
- X}
- X
- Xsend (s)
- Xchar *s;
- X{
- X while (*s)
- X fputc (*s++, outfp);
- X}
- X
- Xempty (s)
- Xchar *s;
- X{ while (*s && *s <= ' ')
- X s++;
- X if (*s)
- X return (0);
- X else
- X return (1);
- X}
- X
- Xsplit (line, first, tail)
- Xchar *line; /* input: full input line */
- Xchar *first; /* return: first word of line */
- Xchar *tail; /* return: all others words of line*/
- X{ int last;
- X
- X last = 0;
- X while (*line && isspace (*line) == 0)
- X { last = *line;
- X *first++ = *line++;
- X }
- X *first = '\0';
- X
- X while (*line && isspace (*line))
- X line++;
- X
- X while (*line && *line != '\n')
- X *tail++ = *line++;
- X *tail = '\0';
- X *line = '\0';
- X return (last);
- X}
- X
- Xusage ()
- X{
- X fprintf (stderr, "Usage: psfmail [-s] files... >out.file\n");
- X fprintf (stderr, " where -s = show all header lines\n");
- X fprintf (stderr, " files = input files (or stdin)\n");
- X exit (0);
- X}
- END_OF_FILE
- if test 6468 -ne `wc -c <'psfmail.c'`; then
- echo shar: \"'psfmail.c'\" unpacked with wrong size!
- fi
- # end of 'psfmail.c'
- fi
- if test -f 'selectdef.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'selectdef.c'\"
- else
- echo shar: Extracting \"'selectdef.c'\" \(6371 characters\)
- sed "s/^X//" >'selectdef.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/* s e l e c t d e f . c
- X
- X allow user to select printer from various *.def files
- X and also select defaule page size (letter, a4 etc)
- X
- X Generate a postscript programme (psizes.ps) that should be
- X sent to the printer to print out the actual imageable area.
- X*/
- X/*
- X * $Id: selectdef.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X*/
- X
- X#include <stdio.h>
- X#include "ctp.h"
- X
- Xtypedef struct /* measurement in point */
- X{ char paper_name[60]; /* name of paper size (for command line) */
- X char paper_tray[200]; /* postscript operator to select this tray */
- X int width; /* portrait point width of paper */
- X int height; /* portrait point height of paper */
- X} measure;
- X
- Xchar *psheader = "%!\n\
- X/getsize {\n\
- X /nf nf 1 add def\n\
- X clippath\n\
- X pathbbox\n\
- X} def\n\
- X/sendsize {\n\
- X /ury exch def\n\
- X /urx exch def\n\
- X /lly exch def\n\
- X /llx exch def\n\
- X /str 64 string def\n\
- X show\n\
- X ( ) show\n\
- X llx ceiling cvi str cvs show\n\
- X ( ) show\n\
- X lly ceiling cvi str cvs show\n\
- X ( ) show\n\
- X urx floor cvi str cvs show\n\
- X ( ) show\n\
- X ury floor cvi str cvs show\n\
- X} def\n\
- X/pg save def\n\
- Xnewpath\n\
- X/nf 0 def\n";
- X
- Xchar *psfont = "/Courier findfont 12 scalefont setfont\n";
- X
- Xchar *pstail = "{ /ycoord ycoord -15 add def\n\
- X 50 ycoord moveto\n\
- X sendsize\n\
- X /nf nf 1 sub def\n\
- X nf 0 eq { exit } if\n\
- X} loop\n\
- Xshowpage \n\
- Xpg restore\n\004";
- X
- Xchar printername[100];
- Xint defaultsize;
- X
- Xint screen_lines = 20;
- Xvoid trim();
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int i,j;
- X int many, n, pnumber;
- X char printers[100];
- X FILE *fp, *fpdef;
- X char cmd[300];
- X char resp;
- X int lines;
- X char *env_lines, *getenv();
- X
- X
- X if (env_lines = getenv ("LINES"))
- X screen_lines = atoi (env_lines) - 4;
- X
- X if (argc < 2)
- X { fprintf (stderr, "Cannot find printer definition files (*.def)...\n");
- X exit (1);
- X }
- Xredo:
- X do
- X {
- X pnumber = 0;
- X printf ("\n\n\n SELECT PRINTER TYPE\n\n");
- X many = 0;
- X lines = 0;
- X for (i = 1; i < argc; i++)
- X { if ((fp = fopen (argv[i], "r")) == NULL)
- X exit (1);
- X fgets (printers, 99, fp); /* skip *printer */
- X fgets (printers, 99, fp);
- X trim (printers);
- X n = strlen (printers);
- X if (n < 33)
- X n = 33;
- X many += n;
- X if (many > 66)
- X { many = n;
- X lines++;
- X if (lines % screen_lines == 0)
- X { if ((pnumber = request (&resp, argc)) > 0)
- X goto gotit;
- X if (resp == 'R')
- X goto redo;
- X }
- X else printf ("\n");
- X }
- X printf ("%3d: %-34s", i, printers);
- X fclose (fp);
- X }
- X } while ((pnumber = request (&resp, argc)) == 0);
- Xgotit:
- X printf ("\n");
- X if (access (argv[pnumber], 4) == 0)
- X {
- X if (getsize (argv[pnumber]) == 0)
- X { sprintf (cmd, "cp %s psfprint.def", argv[pnumber]);
- X system (cmd);
- X genpost (argv[pnumber]);
- X }
- X }
- X else
- X { fprintf (stderr, "Cannot find printer definition file: %s\n", argv[pnumber]);
- X exit (1);
- X }
- X exit (0);
- X}
- X
- Xrequest (r, maxno)
- Xchar *r;
- Xint maxno;
- X{ char printers[100];
- X int pnumber;
- X do
- X { *printers = '\0';
- X printf ("\n==> ( q = quit, r = refresh display, ENTER = next screen)\n SELECT PRINTER NUMBER: ");
- X gets (printers);
- X if (UCCHAR (*printers) == 'Q')
- X incomplete ();
- X if (UCCHAR (*printers) == 'R')
- X { *r = 'R';
- X return (0);
- X }
- X pnumber = atoi (printers);
- X if (pnumber < 1)
- X break;
- X else if (pnumber > maxno)
- X printf ("... Invalid printer number\n");
- X else
- X break;
- X } while (1);
- X *r = ' ';
- X return (pnumber);
- X}
- X
- Xgetsize (fn)
- Xchar *fn;
- X{ char ptypes[40][100];
- X char line[100];
- X int ntypes, i, ncol, pnumber;
- X FILE *fpdef;
- X
- X if ((fpdef = fopen (fn, "r")) != NULL)
- X { fgets (printername, 99, fpdef); /* skip *printer */
- X fgets (printername, 99, fpdef);
- X trim (printername);
- X ntypes = 1;
- X for ( ; ; )
- X { fgets (line, 99, fpdef);
- X if (*line == '*')
- X break;
- X trim (line);
- X strcpy (ptypes[ntypes], line);
- X fgets (line, 99, fpdef);
- X fgets (line, 99, fpdef);
- X ntypes++;
- X }
- X fclose (fpdef);
- X printf ("\nPrinter is: %s\n\n", printername);
- X }
- X else
- X { fprintf (stderr, "Cannot find printer definition file: %s\n", fn);
- X return (1);
- X }
- X return (0);
- X}
- X
- Xgenpost (f)
- Xchar *f;
- X{
- X FILE *pdef, *psfile;
- X char line[500];
- X measure page_types[40];
- X int i, j;
- X int x, y;
- X
- X if ((pdef = fopen (f, "r")) != NULL)
- X { fgets (line, 100, pdef); /* skip *printer */
- X fgets (line, 100, pdef); /* skip printer name */
- X fgets (line, 100, pdef); /* skip *paper */
- X for (i = 0; i < 28; i++)
- X { if (fgets (page_types[i].paper_name, 59, pdef) == NULL)
- X break;
- X trim (page_types[i].paper_name);
- X if (page_types[i].paper_name[0] == '*')
- X break;
- X if (fgets (page_types[i].paper_tray, 199, pdef) == NULL)
- X bad_file(f);
- X trim (page_types[i].paper_tray);
- X if (fgets (line, 100, pdef) == NULL)
- X bad_file(f);
- X trim (line);
- X sscanf (line, "%d%d",
- X &page_types[i].width,
- X &page_types[i].height);
- X
- X }
- X page_types[i].paper_name[0] = '\0';
- X fclose (pdef);
- X if ((psfile = fopen ("psizes.ps", "w")) != NULL)
- X { fprintf (psfile, "%s", psheader);
- X for (j = i-1; j >= 0; j--)
- X { lcase (line, page_types[j].paper_name);
- X fprintf (psfile, "%s\n(%-10s:%5d%5d) getsize\n",
- X line,
- X page_types[j].paper_name,
- X page_types[j].width,
- X page_types[j].height);
- X }
- X/*
- X fprintf (psfile, "%s\n", page_types[defaultsize].paper_tray);
- X*/
- X fprintf (psfile, "%s", psfont);
- X x = 50;
- X y = 500;
- X fprintf (psfile, "%d %d moveto\n", x, y);
- X fprintf (psfile, "(Imageable area) show\n");
- X y -= 15;
- X fprintf (psfile, "%d %d moveto\n", x, y);
- X fprintf (psfile, "(");
- X send (printername, psfile);
- X fprintf (psfile, ") show\n");
- X fprintf (psfile, "/ycoord %d def\n", y);
- X fprintf (psfile, "%s", pstail);
- X }
- X else
- X fprintf (stderr, "Cannot create psizes.ps\n");
- X }
- X else
- X fprintf (stderr, "Cannot open %s for reading\n", f);
- X}
- X
- X
- Xvoid trim (s) /* trim trailing blanks and \n */
- Xchar *s;
- X{ int many;
- X
- X for (many = strlen (s) - 1; many >= 0; many--)
- X { if (isgraph (s[many]))
- X break;
- X else
- X s[many] = '\0';
- X }
- X}
- X
- X
- X
- Xbad_file(f)
- Xchar *f;
- X{
- X fprintf (stderr, "Bad %s file\n", f);
- X exit (1);
- X}
- X
- Xlcase (a, b)
- Xchar *a, *b;
- X{
- X while (*b)
- X { *a++ = LCCHAR (*b);
- X b++;
- X }
- X *a = '\0';
- X}
- X
- Xsend (s, fp)
- Xchar *s;
- XFILE *fp;
- X{
- X char *strchr();
- X
- X while (*s)
- X {
- X if (strchr ("\r\b\\()", *s) != NULL)
- X fputc ('\\', fp);
- X fputc (*s, fp);
- X s++;
- X }
- X}
- X
- Xincomplete ()
- X{
- X printf ("Incomplete printer installation\n");
- X exit (44);
- X}
- END_OF_FILE
- if test 6371 -ne `wc -c <'selectdef.c'`; then
- echo shar: \"'selectdef.c'\" unpacked with wrong size!
- fi
- # end of 'selectdef.c'
- fi
- echo shar: End of archive 5 \(of 9\).
- cp /dev/null ark5isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
-